clear; clc;
close all

depth = 1E4;
Dz = 20;
Nz = ceil(depth/Dz);
z = 0:Dz:Dz*Nz;
S = ones(Nz+1, 1)*0.1;
% 频率设置：10^-4 到 10^3 Hz，40个对数间隔点
fre = logspace(-4, 3, 40);

[Ex, rho_a, phase] = MT1D_FDM(depth, Nz, S, fre);

idx = 29;
plot(real(Ex(:,idx)), -z/1000, 'r');
hold on
plot(imag(Ex(:,idx)), -z/1000, '--');
xlabel('E_x/E_0');
ylabel('深度/km');
legend('实部值', '虚部值');